/*
 * STMROS Plugin factory classes
 */

#pragma once

#ifndef STMROS__PLUGIN_FACTORY_HPP_
#define STMROS__PLUGIN_FACTORY_HPP_

#include <memory>
#include <string>
#include <vector>

#include "stmros/plugin.hpp"

namespace stmros
{
namespace plugin
{

class PluginFactory
{
public:
  virtual ~PluginFactory() = default;
  
  virtual std::shared_ptr<Plugin> create(StmRosPtr stmros) = 0;
  virtual std::string get_class_name() const = 0;
};

template<typename T>
class PluginFactoryTemplate : public PluginFactory
{
public:
  std::shared_ptr<Plugin> create(StmRosPtr stmros) override
  {
    return std::make_shared<T>(stmros);
  }
  
  std::string get_class_name() const override
  {
    return typeid(T).name();
  }
};

} // namespace plugin
} // namespace stmros

#endif // STMROS__PLUGIN_FACTORY_HPP_